<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>
            .box {
                width: 300px;
                height: 300px;
                background-color: pink;
                margin: 200px ;
            }
        </style>
    </head>
    <body>
        <div class="box"></div>
        <script type="text/javascript">
            var box = document.querySelector('.box');
            box.addEventListener('mousemove', function(e) {
                var x = e.pageX - this.offsetLeft;
                var y = e.pageY - this.offsetTop;
                this.innerHTML = 'X坐标是' + x + ' Y坐标是' + y;
            })
        </script>
    </body>
</html>
